
package jgf.exceptions;

/**
 *
 * @author Marcos Garcia Ortega <a href="mailto:thiamath@gmail.com">&lt;thiamath@gmail.com&gt;</a>
 */
public class JGSException extends Exception{

    protected Class ejectorClass;
	protected String methodName;
	protected String[] parameters;
    protected String message = "General Exception";

    public JGSException(){
        this.ejectorClass = null;
		this.methodName = "";
    }

    public JGSException(Class ejectorClass){
        this.ejectorClass = ejectorClass;
		this.methodName = "";
    }

    public JGSException(Class ejectorClass, String methodName, String[] parameters){
        this(ejectorClass);
        this.methodName = methodName;
		this.parameters = parameters;
    }

	public Class getEjectorClass() {
		return ejectorClass;
	}

	public String getMethodName() {
		return methodName;
	}

	@Override
	public String toString(){
		String ret = message;
		ret += " caused in the class " + getEjectorClass().getCanonicalName();
		ret += " in the call of the method " + getMethodName();
		ret += "(";
		for (String param : parameters) {
			ret += param + "";
		}
		ret += ")";
		return ret;
	}
}
